﻿using System;

namespace CSSpec
{
    public class StatePersister<TTestState>  
    {
        private readonly TTestState testState;

        public StatePersister(TTestState testState)
        {
            this.testState = testState;
        }
        /// <summary>
        /// Invokes the provided method and persists the test state object.
        /// </summary> 
        public StatePersister<TTestState> When(Action<TTestState> when)
        {
            when(testState);
            return this;
        }
        /// <summary>
        /// Invokes the provided method and persists the test state object.
        /// </summary> 
        public StatePersister<TTestState> Then(Action<TTestState> then)
        {
            then(testState);
            return this;
        } 
    }
}
